import request from '@/utils/request'
import type { LoginForm, LoginResponse } from '@/types'

// 登录
export const login = (data: LoginForm): Promise<LoginResponse> => {
  return request.post('/auth/login', data)
}

// 获取用户信息
export const getUserInfo = (): Promise<any> => {
  return request.get('/auth/userinfo')
}

// 登出
export const logout = (): Promise<void> => {
  return request.post('/auth/logout')
}

// 获取验证码
export const getCaptcha = (): Promise<{ image: string; key: string }> => {
  return request.get('/auth/captcha')
}